package qldc.pm.qlktcsdldc.model;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.model.BaseModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.util.PortalUtil;

import qldc.pm.qlktcsdldc.service.ClpSerializer;
import qldc.pm.qlktcsdldc.service.DanhMucSoBanNganhLocalServiceUtil;

import java.io.Serializable;

import java.lang.reflect.Method;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;


public class DanhMucSoBanNganhClp extends BaseModelImpl<DanhMucSoBanNganh>
    implements DanhMucSoBanNganh {
    private long _IDQLKT_DanhMucSoBanNganh;
    private long _groupId;
    private long _companyId;
    private long _userId;
    private String _userUuid;
    private String _userName;
    private Date _createDate;
    private Date _modifiedDate;
    private String _TenSoBanNganh;
    private String _DiaChi;
    private String _SoDienThoai;
    private String _Fax;
    private String _Email;
    private String _NguoiLienHe;
    private String _Website;
    private String _ChuThich;
    private Boolean _deleted;
    private BaseModel<?> _danhMucSoBanNganhRemoteModel;

    public DanhMucSoBanNganhClp() {
    }

    @Override
    public Class<?> getModelClass() {
        return DanhMucSoBanNganh.class;
    }

    @Override
    public String getModelClassName() {
        return DanhMucSoBanNganh.class.getName();
    }

    @Override
    public long getPrimaryKey() {
        return _IDQLKT_DanhMucSoBanNganh;
    }

    @Override
    public void setPrimaryKey(long primaryKey) {
        setIDQLKT_DanhMucSoBanNganh(primaryKey);
    }

    @Override
    public Serializable getPrimaryKeyObj() {
        return _IDQLKT_DanhMucSoBanNganh;
    }

    @Override
    public void setPrimaryKeyObj(Serializable primaryKeyObj) {
        setPrimaryKey(((Long) primaryKeyObj).longValue());
    }

    @Override
    public Map<String, Object> getModelAttributes() {
        Map<String, Object> attributes = new HashMap<String, Object>();

        attributes.put("IDQLKT_DanhMucSoBanNganh", getIDQLKT_DanhMucSoBanNganh());
        attributes.put("groupId", getGroupId());
        attributes.put("companyId", getCompanyId());
        attributes.put("userId", getUserId());
        attributes.put("userName", getUserName());
        attributes.put("createDate", getCreateDate());
        attributes.put("modifiedDate", getModifiedDate());
        attributes.put("TenSoBanNganh", getTenSoBanNganh());
        attributes.put("DiaChi", getDiaChi());
        attributes.put("SoDienThoai", getSoDienThoai());
        attributes.put("Fax", getFax());
        attributes.put("Email", getEmail());
        attributes.put("NguoiLienHe", getNguoiLienHe());
        attributes.put("Website", getWebsite());
        attributes.put("ChuThich", getChuThich());
        attributes.put("deleted", getDeleted());

        return attributes;
    }

    @Override
    public void setModelAttributes(Map<String, Object> attributes) {
        Long IDQLKT_DanhMucSoBanNganh = (Long) attributes.get(
                "IDQLKT_DanhMucSoBanNganh");

        if (IDQLKT_DanhMucSoBanNganh != null) {
            setIDQLKT_DanhMucSoBanNganh(IDQLKT_DanhMucSoBanNganh);
        }

        Long groupId = (Long) attributes.get("groupId");

        if (groupId != null) {
            setGroupId(groupId);
        }

        Long companyId = (Long) attributes.get("companyId");

        if (companyId != null) {
            setCompanyId(companyId);
        }

        Long userId = (Long) attributes.get("userId");

        if (userId != null) {
            setUserId(userId);
        }

        String userName = (String) attributes.get("userName");

        if (userName != null) {
            setUserName(userName);
        }

        Date createDate = (Date) attributes.get("createDate");

        if (createDate != null) {
            setCreateDate(createDate);
        }

        Date modifiedDate = (Date) attributes.get("modifiedDate");

        if (modifiedDate != null) {
            setModifiedDate(modifiedDate);
        }

        String TenSoBanNganh = (String) attributes.get("TenSoBanNganh");

        if (TenSoBanNganh != null) {
            setTenSoBanNganh(TenSoBanNganh);
        }

        String DiaChi = (String) attributes.get("DiaChi");

        if (DiaChi != null) {
            setDiaChi(DiaChi);
        }

        String SoDienThoai = (String) attributes.get("SoDienThoai");

        if (SoDienThoai != null) {
            setSoDienThoai(SoDienThoai);
        }

        String Fax = (String) attributes.get("Fax");

        if (Fax != null) {
            setFax(Fax);
        }

        String Email = (String) attributes.get("Email");

        if (Email != null) {
            setEmail(Email);
        }

        String NguoiLienHe = (String) attributes.get("NguoiLienHe");

        if (NguoiLienHe != null) {
            setNguoiLienHe(NguoiLienHe);
        }

        String Website = (String) attributes.get("Website");

        if (Website != null) {
            setWebsite(Website);
        }

        String ChuThich = (String) attributes.get("ChuThich");

        if (ChuThich != null) {
            setChuThich(ChuThich);
        }

        Boolean deleted = (Boolean) attributes.get("deleted");

        if (deleted != null) {
            setDeleted(deleted);
        }
    }

    @Override
    public long getIDQLKT_DanhMucSoBanNganh() {
        return _IDQLKT_DanhMucSoBanNganh;
    }

    @Override
    public void setIDQLKT_DanhMucSoBanNganh(long IDQLKT_DanhMucSoBanNganh) {
        _IDQLKT_DanhMucSoBanNganh = IDQLKT_DanhMucSoBanNganh;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setIDQLKT_DanhMucSoBanNganh",
                        long.class);

                method.invoke(_danhMucSoBanNganhRemoteModel,
                    IDQLKT_DanhMucSoBanNganh);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public long getGroupId() {
        return _groupId;
    }

    @Override
    public void setGroupId(long groupId) {
        _groupId = groupId;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setGroupId", long.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, groupId);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public long getCompanyId() {
        return _companyId;
    }

    @Override
    public void setCompanyId(long companyId) {
        _companyId = companyId;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setCompanyId", long.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, companyId);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public long getUserId() {
        return _userId;
    }

    @Override
    public void setUserId(long userId) {
        _userId = userId;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setUserId", long.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, userId);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getUserUuid() throws SystemException {
        return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
    }

    @Override
    public void setUserUuid(String userUuid) {
        _userUuid = userUuid;
    }

    @Override
    public String getUserName() {
        return _userName;
    }

    @Override
    public void setUserName(String userName) {
        _userName = userName;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setUserName", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, userName);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public Date getCreateDate() {
        return _createDate;
    }

    @Override
    public void setCreateDate(Date createDate) {
        _createDate = createDate;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setCreateDate", Date.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, createDate);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public Date getModifiedDate() {
        return _modifiedDate;
    }

    @Override
    public void setModifiedDate(Date modifiedDate) {
        _modifiedDate = modifiedDate;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setModifiedDate", Date.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, modifiedDate);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getTenSoBanNganh() {
        return _TenSoBanNganh;
    }

    @Override
    public void setTenSoBanNganh(String TenSoBanNganh) {
        _TenSoBanNganh = TenSoBanNganh;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setTenSoBanNganh", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, TenSoBanNganh);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getDiaChi() {
        return _DiaChi;
    }

    @Override
    public void setDiaChi(String DiaChi) {
        _DiaChi = DiaChi;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setDiaChi", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, DiaChi);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getSoDienThoai() {
        return _SoDienThoai;
    }

    @Override
    public void setSoDienThoai(String SoDienThoai) {
        _SoDienThoai = SoDienThoai;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setSoDienThoai", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, SoDienThoai);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getFax() {
        return _Fax;
    }

    @Override
    public void setFax(String Fax) {
        _Fax = Fax;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setFax", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, Fax);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getEmail() {
        return _Email;
    }

    @Override
    public void setEmail(String Email) {
        _Email = Email;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setEmail", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, Email);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getNguoiLienHe() {
        return _NguoiLienHe;
    }

    @Override
    public void setNguoiLienHe(String NguoiLienHe) {
        _NguoiLienHe = NguoiLienHe;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setNguoiLienHe", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, NguoiLienHe);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getWebsite() {
        return _Website;
    }

    @Override
    public void setWebsite(String Website) {
        _Website = Website;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setWebsite", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, Website);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public String getChuThich() {
        return _ChuThich;
    }

    @Override
    public void setChuThich(String ChuThich) {
        _ChuThich = ChuThich;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setChuThich", String.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, ChuThich);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    @Override
    public Boolean getDeleted() {
        return _deleted;
    }

    @Override
    public void setDeleted(Boolean deleted) {
        _deleted = deleted;

        if (_danhMucSoBanNganhRemoteModel != null) {
            try {
                Class<?> clazz = _danhMucSoBanNganhRemoteModel.getClass();

                Method method = clazz.getMethod("setDeleted", Boolean.class);

                method.invoke(_danhMucSoBanNganhRemoteModel, deleted);
            } catch (Exception e) {
                throw new UnsupportedOperationException(e);
            }
        }
    }

    public BaseModel<?> getDanhMucSoBanNganhRemoteModel() {
        return _danhMucSoBanNganhRemoteModel;
    }

    public void setDanhMucSoBanNganhRemoteModel(
        BaseModel<?> danhMucSoBanNganhRemoteModel) {
        _danhMucSoBanNganhRemoteModel = danhMucSoBanNganhRemoteModel;
    }

    public Object invokeOnRemoteModel(String methodName,
        Class<?>[] parameterTypes, Object[] parameterValues)
        throws Exception {
        Object[] remoteParameterValues = new Object[parameterValues.length];

        for (int i = 0; i < parameterValues.length; i++) {
            if (parameterValues[i] != null) {
                remoteParameterValues[i] = ClpSerializer.translateInput(parameterValues[i]);
            }
        }

        Class<?> remoteModelClass = _danhMucSoBanNganhRemoteModel.getClass();

        ClassLoader remoteModelClassLoader = remoteModelClass.getClassLoader();

        Class<?>[] remoteParameterTypes = new Class[parameterTypes.length];

        for (int i = 0; i < parameterTypes.length; i++) {
            if (parameterTypes[i].isPrimitive()) {
                remoteParameterTypes[i] = parameterTypes[i];
            } else {
                String parameterTypeName = parameterTypes[i].getName();

                remoteParameterTypes[i] = remoteModelClassLoader.loadClass(parameterTypeName);
            }
        }

        Method method = remoteModelClass.getMethod(methodName,
                remoteParameterTypes);

        Object returnValue = method.invoke(_danhMucSoBanNganhRemoteModel,
                remoteParameterValues);

        if (returnValue != null) {
            returnValue = ClpSerializer.translateOutput(returnValue);
        }

        return returnValue;
    }

    @Override
    public void persist() throws SystemException {
        if (this.isNew()) {
            DanhMucSoBanNganhLocalServiceUtil.addDanhMucSoBanNganh(this);
        } else {
            DanhMucSoBanNganhLocalServiceUtil.updateDanhMucSoBanNganh(this);
        }
    }

    @Override
    public DanhMucSoBanNganh toEscapedModel() {
        return (DanhMucSoBanNganh) ProxyUtil.newProxyInstance(DanhMucSoBanNganh.class.getClassLoader(),
            new Class[] { DanhMucSoBanNganh.class },
            new AutoEscapeBeanHandler(this));
    }

    @Override
    public Object clone() {
        DanhMucSoBanNganhClp clone = new DanhMucSoBanNganhClp();

        clone.setIDQLKT_DanhMucSoBanNganh(getIDQLKT_DanhMucSoBanNganh());
        clone.setGroupId(getGroupId());
        clone.setCompanyId(getCompanyId());
        clone.setUserId(getUserId());
        clone.setUserName(getUserName());
        clone.setCreateDate(getCreateDate());
        clone.setModifiedDate(getModifiedDate());
        clone.setTenSoBanNganh(getTenSoBanNganh());
        clone.setDiaChi(getDiaChi());
        clone.setSoDienThoai(getSoDienThoai());
        clone.setFax(getFax());
        clone.setEmail(getEmail());
        clone.setNguoiLienHe(getNguoiLienHe());
        clone.setWebsite(getWebsite());
        clone.setChuThich(getChuThich());
        clone.setDeleted(getDeleted());

        return clone;
    }

    @Override
    public int compareTo(DanhMucSoBanNganh danhMucSoBanNganh) {
        int value = 0;

        if (getIDQLKT_DanhMucSoBanNganh() < danhMucSoBanNganh.getIDQLKT_DanhMucSoBanNganh()) {
            value = -1;
        } else if (getIDQLKT_DanhMucSoBanNganh() > danhMucSoBanNganh.getIDQLKT_DanhMucSoBanNganh()) {
            value = 1;
        } else {
            value = 0;
        }

        if (value != 0) {
            return value;
        }

        return 0;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }

        if (!(obj instanceof DanhMucSoBanNganhClp)) {
            return false;
        }

        DanhMucSoBanNganhClp danhMucSoBanNganh = (DanhMucSoBanNganhClp) obj;

        long primaryKey = danhMucSoBanNganh.getPrimaryKey();

        if (getPrimaryKey() == primaryKey) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return (int) getPrimaryKey();
    }

    @Override
    public String toString() {
        StringBundler sb = new StringBundler(33);

        sb.append("{IDQLKT_DanhMucSoBanNganh=");
        sb.append(getIDQLKT_DanhMucSoBanNganh());
        sb.append(", groupId=");
        sb.append(getGroupId());
        sb.append(", companyId=");
        sb.append(getCompanyId());
        sb.append(", userId=");
        sb.append(getUserId());
        sb.append(", userName=");
        sb.append(getUserName());
        sb.append(", createDate=");
        sb.append(getCreateDate());
        sb.append(", modifiedDate=");
        sb.append(getModifiedDate());
        sb.append(", TenSoBanNganh=");
        sb.append(getTenSoBanNganh());
        sb.append(", DiaChi=");
        sb.append(getDiaChi());
        sb.append(", SoDienThoai=");
        sb.append(getSoDienThoai());
        sb.append(", Fax=");
        sb.append(getFax());
        sb.append(", Email=");
        sb.append(getEmail());
        sb.append(", NguoiLienHe=");
        sb.append(getNguoiLienHe());
        sb.append(", Website=");
        sb.append(getWebsite());
        sb.append(", ChuThich=");
        sb.append(getChuThich());
        sb.append(", deleted=");
        sb.append(getDeleted());
        sb.append("}");

        return sb.toString();
    }

    @Override
    public String toXmlString() {
        StringBundler sb = new StringBundler(52);

        sb.append("<model><model-name>");
        sb.append("qldc.pm.qlktcsdldc.model.DanhMucSoBanNganh");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>IDQLKT_DanhMucSoBanNganh</column-name><column-value><![CDATA[");
        sb.append(getIDQLKT_DanhMucSoBanNganh());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>groupId</column-name><column-value><![CDATA[");
        sb.append(getGroupId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>companyId</column-name><column-value><![CDATA[");
        sb.append(getCompanyId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userId</column-name><column-value><![CDATA[");
        sb.append(getUserId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userName</column-name><column-value><![CDATA[");
        sb.append(getUserName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>createDate</column-name><column-value><![CDATA[");
        sb.append(getCreateDate());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
        sb.append(getModifiedDate());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>TenSoBanNganh</column-name><column-value><![CDATA[");
        sb.append(getTenSoBanNganh());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>DiaChi</column-name><column-value><![CDATA[");
        sb.append(getDiaChi());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>SoDienThoai</column-name><column-value><![CDATA[");
        sb.append(getSoDienThoai());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>Fax</column-name><column-value><![CDATA[");
        sb.append(getFax());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>Email</column-name><column-value><![CDATA[");
        sb.append(getEmail());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>NguoiLienHe</column-name><column-value><![CDATA[");
        sb.append(getNguoiLienHe());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>Website</column-name><column-value><![CDATA[");
        sb.append(getWebsite());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>ChuThich</column-name><column-value><![CDATA[");
        sb.append(getChuThich());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>deleted</column-name><column-value><![CDATA[");
        sb.append(getDeleted());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
